﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SongSharp.Domain;
using SongSharp.Domain.Objects;
using System.Diagnostics;

namespace SongSharp.Domain.Queueing
{
    /// <summary>
    /// Holds a specific amount of track that is going to be played. This is always synchronized. Nothing goes directly to the PlaybackManager
    /// </summary>
    /// 
    public delegate void ReachedEndOfQueueEventHandler(object sender, EventArgs e);

    public class QueueManager
    {
        private static QueueManager ms_instance;
        public PlayingQueue PlayingQueue { get; private set; }
        public event ReachedEndOfQueueEventHandler ReachedEndOfQueue;

        protected virtual void OnReachedEndOfQueue(EventArgs e)
        {
            if (ReachedEndOfQueue != null)
            {
                ReachedEndOfQueue(this, e);
            }
        }

        public static QueueManager Instance
        {
            get
            {
                if (ms_instance == null)
                {
                    ms_instance = new QueueManager();
                }
                return ms_instance;
            }
        }

        private QueueManager() 
        {
            PlayingQueue = new PlayingQueue();
        }

    }
}
